package com.kgcx.organization.controller;

import com.kgcx.common.bean.RequestData;
import com.kgcx.common.bean.ReturnData;
import com.kgcx.common.controller.BaseController;
import com.kgcx.organization.domain.DriverCensus;
import com.kgcx.organization.service.DriverCensusService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(description = "驾驶员统计", tags = "驾驶员统计接口")
@RestController
@RequestMapping("driverTraining")
public class DriverCensusController extends BaseController {
    @Autowired
    private DriverCensusService driverCensusService;

    @ApiOperation(value = "新增驾驾驶员统计", httpMethod = "POST", notes = "驾驶员统计接口")
    @PostMapping("addDriverCensus")
    public ReturnData addDriverCensus(@RequestBody DriverCensus driverCensus) {
        driverCensusService.insertDriverCensus(driverCensus);
        return new ReturnData();
    }

    /**
     * 专给监管平台提供查询
     */
    @ApiOperation(value = "监管平台查询驾驶员统计信息", httpMethod = "GET", notes = "这是用来给监管平台查询驾驶员统计信息的接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "页码", required = false, paramType = "query", dataType = "int", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "pageSize", value = "页容量", required = false, paramType = "query", dataType = "int", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "orderBy", value = "排序,sql格式", required = false, paramType = "query", dataType = "String", dataTypeClass = String.class),
            @ApiImplicitParam(name = "kid", value = "主键ID", required = false, paramType = "query", dataType = "int", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "licenseId", value = "驾驶证编号", required = false, paramType = "query", dataType = "int", dataTypeClass = Integer.class)
    })
    @GetMapping("queryDriverGensusWithPage")
    public ReturnData<List<DriverCensus>> queryDriverGensusWithPage() {
        RequestData rd = this.getRequestData();
        List<DriverCensus> driverList = driverCensusService.queryDriverGensusWithPage(rd);
        return new ReturnData<>(driverList);
    }

}
